local jiqiao = fk.CreateSkill({
    name = "sj6__jiqiao",
})

Fk:loadTranslationTable{
  ["sj6__jiqiao"] = "讥诮",
  [":sj6__jiqiao"] = "当一名角色使用【酒】而回复体力，或进入酗酒状态时，你可以令效果改为另一种。",

  ["#sj6__jiqiao_1"] = "讥诮：%dest 即将回复1点体力，你可以令其改为进入酗酒状态",
  ["#sj6__jiqiao_2"] = "讥诮：%dest 即将进入酗酒状态，你可以令其改为回复1点体力",
  
  ["$sj6__jiqiao1"] = "哼，树敌三千又如何？",
  ["$sj6__jiqiao2"] = "难道一切不在朕手中？",
}

jiqiao:addEffect(fk.PreHpRecover, {
    can_trigger = function(self, event, target ,player, data)
      return player:hasSkill(jiqiao.name) and data.card and data.card.skill.name == "analeptic_skill" and not table.contains(data.card.skillNames, jiqiao.name)
    end,
    on_cost = function (self, event, target, player, data)
      return player.room:askToSkillInvoke(player,{
        skill_name = jiqiao.name,
        prompt = "#sj6__jiqiao_1::"..target.id,
      })
    end,
    on_use = function(self, event, target, player, data)
      data:preventRecover()
      target.drank = target.drank + 1
      player.room:broadcastProperty(target, "drank")
    end,
})

jiqiao:addEffect(fk.PreCardEffect, {
  can_trigger = function(self, event, target ,player, data)
    return player:hasSkill(jiqiao.name) and data.card.skill.name == "analeptic_skill"
  end,
  on_cost = function (self, event, target, player, data)
    local to = data.to
    local room = player.room
    if not (data.extra_data and data.extra_data.analepticRecover) then
      if to:isWounded() and not to.dead then
        return room:askToSkillInvoke(player,{
          skill_name = jiqiao.name,
          prompt = "#sj6__jiqiao_2::"..target.id,
        })
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    data.nullified = true
    player.room.logic:getCurrentEvent().parent:addExitFunc(function () --在用完之后减次数
      player:setSkillUseHistory("analeptic_skill",player:usedSkillTimes("analeptic_skill") - 1,Player.HistoryTurn)
      player:setCardUseHistory("analeptic",player:usedCardTimes("analeptic") - 1,Player.HistoryTurn)
    end)
    --data.use.extraUse = true
    table.insert(data.card.skillNames,jiqiao.name)
    player.room:recover({
      who = data.to,
      num = 1,
      recoverBy = data.from,
      card = data.card,
    })
  end,
})

return jiqiao